#include <vector>
#include <iostream>
using namespace std;

float table[20][250000];

inline float min(float a, float b) {
    return (a < b ? a : b);
}



inline int log2(int n) {
    int count = 0;
    for (int product = 1; product <= n; product <<= 1, count++);
    return (count-1);
}

int main() {

    int n;
    cin >> n;

    for (int i = 0; i < n; i++)
        cin >> table[0][i];

    int length = 2;

    for (int step = 1; length <= n; step++, length <<= 1)
        for (int i = 0; i < n - length + 1; i++)
            table[step][i] = min(table[step-1][i], table[step-1][i + (1<<(step-1))]);

    int m;
    int l, r;
    cin >> m;

    for (int i = 0; i < m; i++) {
        scanf("%d", &l);
        scanf("%d", &r);
        int degree = log2(r - l);
        printf("%f\n", min(table[degree][l], table[degree][r - (1<<degree)]) );
    }

    return 0;

}
